#!/usr/bin/env node

const fs = require('fs'),
      lnkName = process.argv[2],
      log = console.log,
      err = console.error;

// lnk -> src
//  lnkName -> readlinkSync()

if(typeof(lnkName) === 'undefined' || process.argv.length !== 3){
  err('命令行参数不正确！');
  process.exit(1);
}

try{
  log(`${lnkName} -> ${fs.readlinkSync(lnkName)}`);
}catch(e){
  err(e.message);
  process.exit(2);
}
